<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('修改党建答题详情')" />
</head>
<body class="gray-bg">
	
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>修改党建答题详情</h5>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal m" id="form-detail-edit" th:object="${examDetail}">
							<input name="id" th:field="*{id}" type="hidden">
							<div class="form-group">
								<label class="col-sm-3 control-label">记录ID：</label>
								<div class="col-sm-8">
									<input name="recordId" th:field="*{recordId}" class="form-control" type="number" required>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">题目ID：</label>
								<div class="col-sm-8">
									<input name="questionId" th:field="*{questionId}" class="form-control" type="number" required>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">用户答案：</label>
								<div class="col-sm-8">
									<input name="userAnswer" th:field="*{userAnswer}" class="form-control" type="text">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">是否正确：</label>
								<div class="col-sm-8">
									<select name="isCorrect" th:field="*{isCorrect}" class="form-control">
										<option value="0">错误</option>
										<option value="1">正确</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<div class="form-control-static col-sm-offset-9">
									<button type="submit" class="btn btn-primary">提交</button>
									<button type="button" class="btn btn-danger" onclick="closeItem()">关闭</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	
	<script type="text/javascript">
		var prefix = ctx + "system/exam/detail";
		
		$("#form-detail-edit").validate({
			rules: {
				recordId: {
					required: true,
					digits: true
				},
				questionId: {
					required: true,
					digits: true
				}
			},
			messages: {
				recordId: {
					required: "请输入记录ID",
					digits: "记录ID必须为整数"
				},
				questionId: {
					required: "请输入题目ID",
					digits: "题目ID必须为整数"
				}
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/edit", $('#form-detail-edit').serialize());
			}
		});
		
		function closeItem() {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		}
	</script>
</body>
</html>